<template>
  <div>
<h2>{{name }}--{{ age }}</h2>
<button @click="addAge">+</button>
  </div>
</template>

<script>
import { reactive,  toRefs } from 'vue'
export default {
  setup () {
    const info=reactive(
      {
        name:'大叔',
        age:18
      }
    )
      // let {name,age}=info  //结构
      // let age=toRef(info,'age')
      // let name=toRef(info,'name')

      // let {name,age}=toRefs(info)


    let addAge=()=>{
      info.age++
      // console.log(age);
    }

    return {
      ...toRefs(info),addAge
    }
  }
}
</script>

<style  scoped>

</style>